<!-- 聊天头 -->
<template>
  <div class="header_box">
    <span v-if="isGroup">{{ chatName }}</span>
    <div v-else>
      <span
        >{{ currentChatUserInfo.name }}({{ currentChatUserInfo.code }})</span
      >
      <div class="detail-info_content">
        <span>{{ currentChatUserInfo.duties || "--" }}</span>
        <span>{{ currentChatUserInfo.departmentName || "--" }}</span>
        <span>值班电话：{{ currentChatUserInfo.onDutyPhone || "--" }}</span>
        <span>工作电话：{{ currentChatUserInfo.workPhone || "--" }}</span>
        <span>手机号：{{ currentChatUserInfo.phone || "--" }}</span>
      </div>
    </div>
    <span
      v-if="
        ($store.state.isGroup &&
          currentChatInfo.status === CHAT_STATUS.NORMAL) ||
        isSingleChat
      "
      @click="$emit('top-view')"
    >
      <i class="el-icon-more"></i>
    </span>
  </div>
</template>

<script>
import { CHAT_STATUS } from "@/utils/constant"
import { mapGetters, mapState } from "vuex"
export default {
  name: "headerPage",
  props: {},
  data() {
    return {
      info: {},
      CHAT_STATUS
    }
  },

  created() {},

  computed: {
    ...mapGetters(["currentChatName"]),
    ...mapState(["currentChatUserInfo", "isGroup", "currentChatInfo"]),
    isSingleChat() {
      return this.$route.path === "/chat"
    },
    chatName() {
      return this.isGroup ? this.currentChatName : this.currentChatInfo.name
    }
  },

  methods: {}
}
</script>
<style lang="less" scoped>
.header_box {
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  font-size: 15px;
  color: #333333;
  letter-spacing: 0;
  font-weight: 600;
  span {
    cursor: pointer;
  }

  .detail-info_content {
    font-size: 14px;
    color: #666666;
    font-weight: 500;
    span {
      padding-right: 5px;
    }
  }
}
</style>
